<?php
/**
 * User: hjd-yao
 * Date: 2019/2/15
 * Time: 13:50
 */

namespace App\Helpers;


class SelfValidationRule
{
    public static function mobileFormat($value)
    {
        $pattern = '/^1[3-9]\d{9}$/';
        return preg_match($pattern,$value);
    }

    public static function alphaStart($value)
    {
        $pattern = '/^[A-Za-z][a-zA-Z0-9_]*/';
        return preg_match($pattern,$value);
    }

    public static function pwdSafetyFormat($value)
    {
        $pattern = '/^.*(?=.{6,})(?=.*\d)(?=.*[A-Z])(?=.*[a-z])(?=.*[!@#$%^&*?_\)\(]<>).*$/';
        return preg_match($pattern,$value);
    }

    public static function pwdSimpleFormat($value)
    {
        $pattern = '/(\S{6,})$/';
        return preg_match($pattern,$value);
    }

    public static function textSafetyFormat($value)
    {
        $pattern = '/^[A-Za-z0-9\x{4e00}-\x{9fa5}\[,，！!?？。\.\]]+$/um';
        return preg_match($pattern,$value);
    }

}